<template>
  <view class="content">
    <u-swiper height="300rpx" :list="swiper" indicator imgMode="aspectFit"></u-swiper>
    <view class="info-content">
      <u-cell size="large" title="律所名称" :value="form.deptName"></u-cell>
      <u-cell size="large" title="律所描述" :value="form.firmDescription"></u-cell>
      <u-cell size="large" title="律所导语" :value="form.firmIntroduction"></u-cell>
    </view>
  </view>
</template>

<script>
import { mapGetters } from 'vuex'
import lawyerApi from '../request/api/lawyer'
import config from '../request/config'
export default {
  data() {
    return {
      deptId: '',
      form: {},
      swiper: [],
    }
  },
  computed: {
    ...mapGetters('userInfo', ['user']),
  },
  onLoad(option) {
    this.deptId = option.deptId
    this.getDetail()
  },
  // 下拉刷新
  async onPullDownRefresh() {
    await this.getDetail()
    uni.stopPullDownRefresh()
  },
  methods: {
    async getDetail() {
      uni.showLoading({
        title: '加载中',
        mask: true,
      });
      try {
        var { data } = await lawyerApi.getDeptDetail(this.deptId)
      } catch (error) {
        return
      } finally {
        uni.hideLoading()
      }
      this.form = data
      this.swiper = this.form?.firmImages?.split(",")?.map(url => config.baseUrl + url) || []
    },
  },
  onShareAppMessage() {
    return {
      title: this.form.deptName,
      path: `/lawyer/unitDetail?id=${ this.form.deptId }`, // 分享路径
    }
  }
}
</script>

<style>
.info-content .u-cell__value {
  width: 70%;
}
</style>

<style scoped lang="scss">
</style>
